<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script type="text/javascript" src="js/jquery-1.8.3.js"></script>
<!-- <script type="text/javascript" src="../js/jquery-3.1.1.min.js"></script> -->
<link rel="stylesheet" href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<!-- 可选的 Bootstrap 主题文件（一般不用引入） -->
<link rel="stylesheet" href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous">
<!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
<script src="https://cdn.bootcss.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>

<title>Insert title here</title>
</head>
<body>
	<div style="background-color:yellow;">
			<div>
				<form action="#" method="get">
					搜索<input type="text" name="classname" placeholder="班级名字">
					<button type="submit"> 搜索</button>
					<button type="button" onclick="addclass()">新增班级</button>
				</form>
			</div>
			<div >
				<table class="table table-bordered">
					<tr>
						<th>班级ID</th>
						<th>班级名</th>
						<th>带课老师</th>
						<th>班级人数</th>
						<th>开始时间</th>
						<th>结束时间</th>
						<th>状态</th>
						<th>操作</th>
					</tr>
				</table>
			</div>
		</div>
</body>
</html>
<script >
$.ajax({
	url:"http://localhost:8080/QingkeCodeApi/clazz/select",
	type:"GET",
	dataType:"json",
	error:function(){
		alert(error);
	},
	success:function(data){
		data.data.record.forEach(function( val, index ) {
			var ob = new Object();
			ob.id=val.cid;
			ob.name = val.className;
			ob.studentnumber=val.studentNumber;
			ob.teacher=val.teacherName;
			ob.starttime=val.startTime;
			ob.endtime=val.endTime;
			var column = "<tr><td>"+ob.id+"</td><td>"+ob.name+"</td><td>"+ob.teacher+"</td><td>"+ob.studentnumber+"</td><td>"+ob.starttime+"</td><td>"+ob.starttime+"</td><th>1</th><td><a href='#'>编辑</a>&nbsp;&nbsp;<a href='#'>删除</a></td></tr>";
			$("table.table tr:first").before(column);		
		});
	},
})
function edit(){
	window.location.href="classedit.jsp";
};
function addclass(){
	window.location.href="addclass.jsp";
};

</script>